package com.rxsk.cas.pojo;

import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @Deacription UserDetailPlus, token过滤时得到的当前用户
 */
@Getter
@Setter
public class UserDetailPlus extends User {

    /**
     * userId
     */
    private Long userId;

    /**
     * 真实姓名
     */
    private String realName;

    /**
     * 部门ID
     */
    private Long deptId;

    /**
     * 园区ID
     */
    private Long parkId;

    public UserDetailPlus(Long userId, Long deptId, String realName, String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.userId = userId;
        this.deptId = deptId;
        this.realName = realName;
    }

    public UserDetailPlus(Long userId, Long deptId, String realName, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.userId = userId;
        this.deptId = deptId;
        this.realName = realName;
    }
}
